package huiji;

import java.awt.*;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;

/**
 * 开始游戏按钮
 */
public class StartButton extends BaseObj {
    static public StartButton start1 = new StartButton(ClassLoader.getSystemResource("startgame.png"));
    static public StartButton start2 = new StartButton(ClassLoader.getSystemResource("startgame2.png"));
    static public List<StartButton> startList = new ArrayList(2);//
    static public int index = 0;//0展示小按钮，1展示大按钮。用于鼠标放到按钮上，让按钮变大

    static {
        //将按钮的坐标设置居中
        start1.setX(HuijiJPanel.width/2-start1.getWidth()/2);
        start1.setY(HuijiJPanel.height/2-start1.getHeight()/2);

        start2.setX(HuijiJPanel.width/2-start2.getWidth()/2);
        start2.setY(HuijiJPanel.height/2-start2.getHeight()/2);


        startList.add(start1);
        startList.add(start2);
    }

    static public void paintStart(Graphics g){
        startList.get(index).paint(g);
    }



    public StartButton(URL imageuRL) {
        super(imageuRL);
    }



    @Override
    public StartButton setX(int x) {
        return (StartButton)super.setX(x);
    }

    @Override
    public StartButton setY(int y) {
        return (StartButton)super.setY(y);
    }
}
